// Learn TypeScript:
//  - https://docs.cocos.com/creator/manual/en/scripting/typescript.html
// Learn Attribute:
//  - https://docs.cocos.com/creator/manual/en/scripting/reference/attributes.html
// Learn life-cycle callbacks:
//  - https://docs.cocos.com/creator/manual/en/scripting/life-cycle-callbacks.html

const {ccclass, property} = cc._decorator;

@ccclass
export default class VolumeItem extends cc.Component {

    @property(cc.ProgressBar)
    gressbar: cc.ProgressBar = null;

    setItem (isUp: boolean, precent: number) {
        this.gressbar.progress = precent;
        if (isUp) {
            this.node.color = cc.color(180, 0, 0);
        } else {
            this.node.color = cc.color(0, 150, 0);
        }
    }
}
